/**
 * 
 */
package org.vsg.stock.basic.domain.mybatis;

import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vsg.common.ibatis3.support.SqlSessionTemplateSupport;
import org.vsg.stock.basic.domain.BalanceLine;
import org.vsg.stock.basic.domain.BalanceLineKeyPoint;
import org.vsg.stock.basic.persistence.mybatis.BalanceLineDaoImpl;

/**
 * @author Bill Vison
 *
 */
public class BalanceLineProxy extends BalanceLine implements SqlSessionTemplateSupport {

	private static final Logger logger = LoggerFactory.getLogger(BalanceLineProxy.class);
	
	// ---- defined the dao handle method ----
	private SqlSessionTemplate sqlSessionTemplate ;
	
	public SqlSessionTemplate getSqlSessionTemplate() {
		return sqlSessionTemplate;
	}

	@Override
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	
	public void insertKeyPoints() {
		
		String statement = "org.vsg.stock.basic.domain.mybatis.BalanceLineProxy." +
		"insertBalanceLinePoint";
		for (BalanceLineKeyPoint point : this.getKeyPoints() ) {
			if ( logger.isDebugEnabled() ) {
				logger.debug("insert balincelinepoxy : " + point);
			}
			sqlSessionTemplate.insert(statement, point);
		}
		

		
		
	}

}
